ENTITY EVENTS DOCUMENTATION
Version: 1.21.60.24

This is documentation for a preview release of Minecraft. New features, components, and capabilities in this release are not final and might change without notice before the final release.
Be sure to check the documentation once the release is out of preview if your add-on isn't working properly. Resource and Behavior Packs created for the preview are not guaranteed to work on the final release.

Index

This describes the structure of the Events section.
Overview
Versioned Changes
Randomize Node
Sequence Node
Trigger
Add Component Group
Remove Component Group
Set Entity Property
Queue Command
Entity Events Documentation Back to top

Events Documentation

Overview

Entity events can be structured by a combination of sequence and randomize nodes.

Within randomize and sequence nodes, you can specify operations such as:

When an event is received, its effects are determined immediately, but changes are applied during the next tick on the server side of the game. This can affect subsequent filters in a sequence array or timing when events are sent between entities.

Back to top

Versioned Changes

A format_version of 1.19.20 or higher is required to properly evaluate filters specified at the root level of an event definition. Content with a lower version will use the old behavior, which ignores root-level filters.

Back to top

Randomize Node

The randomize node is an array node that will pick one entry to execute based on a weight. If no weight is specified, a node will have a default weight of 1.0.

Example:

Back to top

Sequence Node

Example:

Back to top

Trigger

Triggers additional entity events when hit. For example, you could use a randomize node in minecraft:entity_spawned to choose either an adult or baby event for adding component groups.

Example:

Back to top

Add Component Group

Adds component groups to the current entity. Components in a group being added will replace previously added components if they are of the same type.

Example:

Back to top

Remove Component Group

Removes component groups from the current entity. The groups must be defined in the component_groups section of the file.

Example:

Back to top

Set Entity Property

Sets the value of an entity property. The property must be defined in the properties section of the file.

Example:

Back to top

Queue Command

Queues a command to be run on the entity. The command will run within the next tick unless the entity has been removed.

Example:

Back to top